package pta.MOOC.ch02.ex12;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder result = new StringBuilder();
        while (true){
            String input = scanner.next();
            if(input.equals("end")){
                break;
            }
            if (input.length()%3==0){
                result.append(input).append(" ");
            }
        }
        System.out.println((result.toString()));
        scanner.close();
    }
}
